--[[
	Project:		TruRP
	Author:			Martin 'Ploo' Pucilowski
	File:			sh_player.lua
	Date:			06/03/2010
	Description:	Handles all shared player methods and functions.
--]]

TRU.Skills = {  }

local function AddSkill( id, name, description )
	--TRU.Skills[ id ].name = name
	--TRU.Skills[ id ].description = description
end

local function GetSkill( id )

end

AddSkill( SKILL_STAMINA, "Stamina", "How much energy you have for physical movement" )
AddSkill( SKILL_SPEED, "Speed", "How fast you can walk and sprint" )
AddSkill( SKILL_STRENGTH, "Strength", "How strong you are" )
AddSkill( SKILL_RESISTANCE, "Resistance", "How much damage you can take" )



local player = FindMetaTable("Player")

function player:TraceEntity( dist )
	ply = self

	local trace = {}
	trace.start = ply:EyePos()
	trace.endpos = trace.start + ply:GetAimVector() * dist
	trace.filter = ply
	local tr = util.TraceLine(trace)
	
	return tr.Entity or nil
end

function player:CanTraceEntity( ent, dist )
	ply = self

	local trace = {}
	trace.start = ply:EyePos()
	trace.endpos = trace.start + ply:GetAimVector() * dist
	trace.filter = ply
	local tr = util.TraceLine(trace)
	
	if tr.Entity == ent then return true end
	return false
end

function player:TraceDropPos()
	ply = self

	local trace = {}
	trace.start = ply:EyePos()
	trace.endpos = trace.start + ply:GetAimVector() * 96
	trace.filter = ply
	local tr = util.TraceLine(trace)
	
	return tr.HitPos
end

function player:TraceDoor()
	ply = self
	
	local trace = {}
	trace.start = ply:EyePos()
	trace.endpos = trace.start + ply:GetAimVector() * 96
	trace.filter = ply
	local ent = util.TraceLine(trace).Entity
	
	if ValidEntity( ent ) and ent:IsDoor() then
		return ent
	end
	return nil
end